#ifndef EGG_CAMERA_H
#define EGG_CAMERA_H

#include "Math3D.h"
#include "Frustum.h"
#include "Viewport.h"
#include "SceneNode.h"

namespace egg{

    class Scene;

    class Camera : public SceneNode{
        friend class Viewport;
    public:
        Camera(Scene* scene);
        void setFov(float value);
        void setFar(float value);
        void setNear(float value);

        inline float getFar(){
            return mFrustum.mFar;
        }
        inline Scene* getScene(){
            return mScene;
        }
        inline Viewport* getViewport(){
            return mViewport;
        }
        inline const Frustum& getFrustum(){
            return mFrustum;
        }
        inline const mat4& getProjectionMatrix(){
            return mProjectionMatrix;
        }
        inline const mat4& getViewMatrix(){
            return mViewMatrix;
        }
    protected:
        void updateTransform();
        void updateProjectionMatrix();
    protected:
        Scene* mScene;
        Viewport* mViewport;
        Frustum mFrustum;
        mat4 mViewMatrix;
        mat4 mProjectionMatrix;
        mat4 mInvProjectionMatrix;
    };

}

#endif